package com.xiaozhengkeji.xiaozhengblog.bean;

import com.xiaozhengkeji.xiaozhengblog.bean.type.ResCodeType;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.extern.slf4j.Slf4j;


@Data
@Slf4j
@ApiModel(value = "返回结构体", description = "返回结构体")
public class ResponseBean {
    //Http状态码
    @ApiModelProperty(value = "返回结果码")
    private Integer code;
    //Http状态信息
    @ApiModelProperty(value = "返回结果简介")
    private String code_name;
    //返回信息
    @ApiModelProperty(value = "返回结果")
    private String msg;
    //返回的数据
    @ApiModelProperty(value = "返回结构体数据")
    private Object data;
    //返回的数据
    @ApiModelProperty(value = "返回结构体数据 - 备用")
    private Object data_standby;

    public ResponseBean(ResCodeType code, String msg, Object data, Object dataStandby) {
        this.code = code.getSTATUS_CODE();
        this.code_name = code.getSTATUS_NAME();
        this.msg = msg;
        this.data = data;
        this.data_standby = dataStandby;
        if (msg == null) this.msg = "null";
        if (data == null) this.data = "null";
        if (dataStandby == null) this.data_standby = "null";
    }
}
